

#ifndef ENVVARS_COMMON_H
#define ENVVARS_COMMON_H

#include <wx/arrstr.h>
#include <wx/string.h>

class wxCheckListBox;


#if (defined (__WIN32__) || defined (_WIN64)) && !wxCHECK_VERSION(3, 0, 0)
    #define CHECK_LIST_BOX_CLIENT_DATA 0
#else
    #define CHECK_LIST_BOX_CLIENT_DATA 1
#endif

#define EV_DBGLOG nsEnvVars::EnvVarsDebugLog


namespace nsEnvVars
{
  extern const wxString EnvVarsSep;     //!< separator for envvars in config
  extern const wxString EnvVarsDefault; 
  
  void          EnvVarsDebugLog(const wxChar* msg, ...);

  
  wxArrayString EnvvarStringTokeniser(const wxString& str);
  
  wxArrayString GetEnvvarSetNames();
  
  wxString      GetActiveSetName();
  
  wxString      GetSetPathByName(const wxString& set_name,
                                 bool check_exists = true,
                                 bool return_default = true);
  
  wxArrayString GetEnvvarsBySetPath(const wxString& set_path);
  
  bool          EnvvarSetExists(const wxString& set_name);
  
  bool          EnvvarVetoUI(const wxString& key, wxCheckListBox* lstEnvVars, int sel);
  
  bool          EnvvarsClearUI(wxCheckListBox* lstEnvVars);
  
  bool          EnvvarIsRecursive(const wxString& key, const wxString& value);
  
  bool          EnvvarDiscard(const wxString& key);
  
  bool          EnvvarApply(const wxString& key, const wxString& value);
  
  bool          EnvvarArrayApply(const wxArrayString& envvar,
                                 wxCheckListBox*      lstEnvVars = NULL);
  
  void          EnvvarSetApply(const wxString& set_name, bool even_if_active);
  
  void          EnvvarSetDiscard(const wxString& set_name);


#if CHECK_LIST_BOX_CLIENT_DATA==1
  struct EnvVariableListClientData : wxClientData
  {
      EnvVariableListClientData(const wxString &_key, const wxString &_value) : key(_key), value(_value) {}
      wxString key, value;
  };
#endif

}
#endif // ENVVARS_COMMON_H
